|
1
|
|
|
// BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
|
2
|
|
|
// |
|
3
|
|
|
// Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
|
4
|
|
|
// |
|
5
|
|
|
// This program is free software; you can redistribute it and/or modify it under the |
|
6
|
|
|
// terms of the GNU Lesser General Public License as published by the Free Software |
|
7
|
|
|
// Foundation; either version 3.0 of the License, or (at your option) any later |
|
8
|
|
|
// version. |
|
9
|
|
|
// |
|
10
|
|
|
// BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
|
11
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
|
12
|
|
|
// PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
|
13
|
|
|
// |
|
14
|
|
|
// You should have received a copy of the GNU Lesser General Public License along |
|
15
|
|
|
// with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
|
16
|
|
|
|
|
17
|
|
|
$(document).on('turbolinks:load', function(){ |
|
18
|
|
|
var controller = $("body").data('controller'); |
|
19
|
|
|
var action = $("body").data('action'); |
|
20
|
|
|
|
|
21
|
|
|
// Only run on the admins page. |
|
22
|
|
|
if (controller == "admins" && action == "index") { |
|
23
|
|
|
// show the modal with the correct form action url |
|
24
|
|
|
$(".delete-user").click(function(data){ |
|
25
|
|
|
var uid = $(data.target).closest("tr").data("user-uid") |
|
26
|
|
|
$("#delete-confirm").parent().attr("action", "/u/" + uid) |
|
27
|
|
|
}) |
|
28
|
|
|
|
|
29
|
|
|
// Change the color of the color inputs when the color is changed |
|
30
|
|
|
$(".colorinput-input").change(function(data) { |
|
31
|
|
|
// Get the color from the input |
|
32
|
|
|
var color = $(data.target).val() |
|
33
|
|
|
|
|
34
|
|
|
// Update the color in the database and reload the page |
|
35
|
|
|
$.post($("#coloring-path").val(), {color: color}).done(function(data) { |
|
|
|
|
|
|
36
|
|
|
location.reload() |
|
37
|
|
|
}); |
|
38
|
|
|
}); |
|
39
|
|
|
|
|
40
|
|
|
// Submit search if the user hits enter |
|
41
|
|
|
$("#search-input").keypress(function(key) { |
|
42
|
|
|
var keyPressed = key.which |
|
43
|
|
|
if (keyPressed == 13) { |
|
44
|
|
|
searchPage() |
|
45
|
|
|
} |
|
46
|
|
|
}) |
|
47
|
|
|
|
|
48
|
|
|
// Add listeners for sort |
|
49
|
|
|
$("th[data-order]").click(function(data){ |
|
50
|
|
|
var header_elem = $(data.target) |
|
51
|
|
|
|
|
52
|
|
|
if(header_elem.data('order') === 'asc'){ // asc |
|
53
|
|
|
header_elem.data('order', 'desc'); |
|
54
|
|
|
} |
|
55
|
|
|
else if(header_elem.data('order') === 'desc'){ // desc |
|
56
|
|
|
header_elem.data('order', 'none'); |
|
57
|
|
|
} |
|
58
|
|
|
else{ // none |
|
59
|
|
|
header_elem.data('order', 'asc'); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
var search = $("#search-input").val() |
|
63
|
|
|
window.location.replace(window.location.pathname + "?page=1&search=" + search + "&column=" + header_elem.data("header") + "&direction="+ header_elem.data('order')) |
|
64
|
|
|
}) |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
// Only run on the admins edit user page. |
|
68
|
|
|
if (controller == "admins" && action == "edit_user") { |
|
69
|
|
|
$("#users").click(function(data){ |
|
70
|
|
|
var url = $("body").data("relative-root") |
|
71
|
|
|
if (!url.endsWith("/")) { |
|
72
|
|
|
url += "/" |
|
73
|
|
|
} |
|
74
|
|
|
url += "admins" |
|
75
|
|
|
|
|
76
|
|
|
window.location.href = url |
|
77
|
|
|
}) |
|
78
|
|
|
} |
|
79
|
|
|
}); |
|
80
|
|
|
|
|
81
|
|
|
// Change the branding image to the image provided |
|
82
|
|
|
function changeBrandingImage(path) { |
|
83
|
|
|
var url = $("#branding-url").val() |
|
84
|
|
|
$.post(path, {url: url}) |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
// Searches the user table for the given string |
|
88
|
|
|
function searchPage() { |
|
89
|
|
|
var search = $("#search-input").val() |
|
90
|
|
|
|
|
91
|
|
|
window.location.replace(window.location.pathname + "?page=1&search=" + search) |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
// Clears the search bar |
|
95
|
|
|
function clearSearch() { |
|
96
|
|
|
window.location.replace(window.location.pathname + "?page=1") |
|
97
|
|
|
} |
|
98
|
|
|
|
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.